<!DOCTYPE>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>箭头功能</title>
    <script src="js/traceur.js"></script>
    <script src="js/bootstrap.js"></script>

    <script>
        var circleArea = function (pi, r) {
            var area = pi * r * r;
            return area;
        }
        var result = circleArea(3.14, 3);
        console.log(result);

        //this
        var object = {
            f1: function () {
                console.log(this); //Object
                var f2 = function () {
                    console.log(this); //Window
                }
                f2();
            }
        }
        object.f1();
    </script>

    <script type="module">
        let circleArea = (pi, r) =>{
            let area = pi * r * r;
            return area;
        }
        let result = circleArea(3.14, 3);
        console.log(result);

        //函数只有一条内容
        let circleArea1 = (pi, r) => pi * r * r;
        let result1 = circleArea1(3.14, 3);
        console.log(result1); //28.26

        //this
        var object = {
            f1: ()=>{
                console.log(this); //Window
                var f2 = ()=>{console.log(this)}
                f2();
            }
        }
        object.f1(); //Window
    </script>
</head>
</html>